package com.hckjsec.common.config;

import com.alibaba.fastjson.JSON;
import com.hckjsec.common.utils.DetectPartnerAuthUtil;

import java.util.ArrayList;
import java.util.List;

public class PartnerView {
    private String code = "SUCCESS";
    private String app_id;//appid
    private String secret;//secret
    private String grant_type = "client_credential";//授权类型，默认值为：client_credential（必须小写）
    private String version = "1.0.0";//版本号
    private String access_token;
    private String sign_ticket;
    private String sign;//生成签名
    private String userId;
    private String nonce;
    private String user_ticket;
    private String userSign;//用户签名
    private String faceId;//faceId

    private String orderNo;//订单号


    public String getApp_id() {
        return app_id;
    }

    public void setApp_id(String app_id) {
        this.app_id = app_id;
    }

    public String getSecret() {
        return secret;
    }

    public void setSecret(String secret) {
        this.secret = secret;
    }

    public String getGrant_type() {
        return grant_type;
    }

    public void setGrant_type(String grant_type) {
        this.grant_type = grant_type;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getAccess_token() {
        return access_token;
    }

    public void setAccess_token(String access_token) {
        this.access_token = access_token;
    }

    public String getSign_ticket() {
        return sign_ticket;
    }

    public void setSign_ticket(String sign_ticket) {
        this.sign_ticket = sign_ticket;
    }


    public String getSign() {
        return sign;
    }

    public void setSign(String sign) {
        this.sign = sign;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getNonce() {
        return nonce;
    }

    public void setNonce(String nonce) {
        this.nonce = nonce;
    }

    public String getUserSign() {
        return userSign;
    }

    public void setUserSign(String userSign) {
        this.userSign = userSign;
    }

    public String getUser_ticket() {
        return user_ticket;
    }

    public void setUser_ticket(String user_ticket) {
        this.user_ticket = user_ticket;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getFaceId() {
        return faceId;
    }

    public void setFaceId(String faceId) {
        this.faceId = faceId;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public void sign(){
        List<String> values = new ArrayList<>();
        values.add(this.version);
        values.add(this.app_id);
        values.add(this.nonce);
        values.add(this.userId);
        this.sign = DetectPartnerAuthUtil.sign(values,this.sign_ticket);
    }

    public void pullSign(){
        List<String> values = new ArrayList<>();
        values.add(this.app_id);
        values.add(this.orderNo);
        values.add(this.version);
        values.add(this.nonce);
        this.sign = DetectPartnerAuthUtil.sign(values,this.sign_ticket);
    }

    public void userSign(){
        List<String> values = new ArrayList<>();
        values.add(this.version);
        values.add(this.app_id);
        values.add(this.nonce);
        values.add(this.userId);
        this.userSign = DetectPartnerAuthUtil.sign(values,this.user_ticket);
    }
}
